package org.groupg.practice.juneau;

import org.apache.juneau.examples.rest.AdminGuard;
import org.apache.juneau.http.annotation.Content;
import org.apache.juneau.http.annotation.Header;
import org.apache.juneau.http.annotation.Query;
import org.apache.juneau.http.response.BadRequest;
import org.apache.juneau.http.response.InternalServerError;
import org.apache.juneau.http.response.Ok;
import org.apache.juneau.http.response.Unauthorized;
import org.apache.juneau.rest.annotation.Rest;
import org.apache.juneau.rest.annotation.RestPost;
import org.apache.juneau.rest.config.BasicUniversalConfig;
import org.apache.juneau.rest.servlet.BasicRestServlet;

import java.util.UUID;

// Server-side endpoint
@Rest(path = "/petstore")
public class PetStoreRest extends BasicRestServlet implements BasicUniversalConfig {

    @RestPost(path = "/pets", guards = AdminGuard.class)
    public Ok addPet(
            @Content CreatePet createPetBean,
            @Header("E-Tag") UUID etag,
            @Query("debug") boolean debug
    ) throws BadRequest, Unauthorized, InternalServerError {
        // Process request here.
        return Ok.OK;  // Standard 400-OK response.
    }
}